package br.upe.dsc.caeto.ui;

import java.awt.Component;
import java.util.EventObject;
import javax.swing.JOptionPane;
import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;

public class CaetoApplication extends SingleFrameApplication {

	@Override
	protected void startup() {
		
		//Show a prompt to confirm the exit action
		addExitListener(new ExitListener() {
			public boolean canExit(EventObject e) {
				boolean okToExit = false;
				Component source = (Component) e.getSource();
				okToExit = JOptionPane.showConfirmDialog(source,
						"Do you really want to exit?") ==
							JOptionPane.YES_OPTION;
				return okToExit;
			}
			public void willExit(EventObject event) {

			}
		});
		
		show(new CaetoMainFrame(this));
	}
	
	public static void main(String[] args) {
		Application.launch(CaetoApplication.class, args);
	}
}
